import request from '/@/utils/request'
import {prefix} from '/@/api/oa'

export function getPage(params: object) {
    return request({
        url: prefix + '/candidate/getPage',
        method: 'get',
        params
    })
}

export function createData(data: object) {
    return request({
        url: prefix + '/candidate/create',
        method: 'post',
        data
    })
}

export function editData(data: object) {
    return request({
        url: prefix + '/candidate/edit',
        method: 'post',
        data
    })
}

export function deleteData(data: object) {
    return request({
        url: prefix + '/candidate/delete',
        method: 'post',
        data
    })
}

export function getStateList(sum = 0) {
    return request({
        url: prefix + '/candidate/getStateList?sum=' + sum,
        method: 'get'
    })
}

export function modifyBatchState(data: object) {
    return request({
        url: prefix + '/candidate/modifyBatchState',
        method: 'post',
        data
    })
}

/**
 * 获取待初筛的候选人列表
 */
export function getListByType(state: string) {
    return request({
        url: prefix + '/candidate/listByType?state=' + state,
        method: 'get'
    })
}

/**
 * 获取候选人的面试官id列表
 */
export function getInterviewerIds(candidateId: string) {
    return request({
        url: prefix + '/candidate/getInterviewerIds?candidateId=' + candidateId,
        method: 'get'
    })
}

/**
 * 获取候选人最后一次面试记录
 */
export function getLastInterviewData(candidateId: string) {
    return request({
        url: prefix + '/candidateInterviewRecord/getLastInterview?candidateId=' + candidateId,
        method: 'get'
    })
}
